package top.wineye.spring.bean.factory;

import org.springframework.beans.factory.InitializingBean;
import top.wineye.model.User;

import javax.annotation.PostConstruct;

public class UserFactory implements InitializingBean {
    public User build() {
        return User.getInstance();
    }

    @PostConstruct
    public void initialByAnnotation() {
        System.out.println("hi, UserFactory has bean initialized by @PostConstruct.  ");
    }


    public void initByInitMethod() {
        System.out.println("hey, this is initialized by init-method");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("hello, this is initialized by InitializingBean#afterPropertiesSet()");
    }

    public void initByBeanDefinition() {
        System.out.println("this initialized by bean definition set init method name ");
    }
}
